package xin.marcher.module.inventory.mq.producer;

import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import xin.marcher.module.common.constants.RocketMqConstant;
import xin.marcher.module.inventory.domain.bo.BucketCapacity;

import javax.annotation.Resource;

/**
 * 分桶扩容的消息队列
 *
 * 
 */
@Slf4j
@Component
public class BucketCapacityProducer {

    @Resource
    private DefaultProducer defaultProducer;

    /**
     * 分桶扩容的消息 MQ生产
     *
     * @param bucketCapacity    分桶扩容
     */
    public void sendBucketCapacity(BucketCapacity bucketCapacity) {
        //发送分桶扩容消息
        defaultProducer.sendAsyncMessage(RocketMqConstant.BUCKET_CAPACITY_TOPIC,
                JSONObject.toJSONString(bucketCapacity), "分桶扩容");
    }
}
